const Koa =  require('koa');
const app = new Koa();
//解决跨域 出现在后端响应回数据时，浏览器不接收
const cors = require('@koa/cors');
const {bodyParser} = require('@koa/bodyparser');
const useRouter = require('./router/index.js')
// const useRouter = require('./router/user.js')

app.use(cors()) //先允许跨域
app.use(bodyParser()) //让koa可以解析post的参数
useRouter(app)
// app.use(useRouter.routes(),useRouter.allowedMethods())


app.listen(3000,() => { 
    console.log('项目已启动！');
})